<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //Number()
    console.log(Number(true),Number(null),+undefined);
    //Boolean()
    console.log(Boolean('100'),Boolean(100),Boolean(null),!!undefined);
    //parslnt()
    console.log(parseInt(123.6),parseInt(0B1011011),parseInt(0X2A),parseInt(0X2A,8))
    //parseFloat()
    console.log(parseFloat( '123.6') , parseFloat( '100px ') , parseFloat(010));
    //eval()
    console.log(eval( '87*99+2'));
    //isNaN
    console.log(isNaN(null),isNaN( '123 ' ),isNaN( ' abc ' ),isNaN( 'a1b2c3' ));
    console.log('-------------------------------------------------------');
    var arr1 = [];
    console.log( arr1, arr1.length);
    var arr2 = [1,2,3];
    console.log( arr2[0], arr2.length);
    var arr3 = new Array();
    //shift删除数组第一个元素
    arr2.shift();
    console.log(arr2);
    console.log( arr3[1],arr3.length);
    console.log('-------------------------------------------------------');
    //获取当前时间
    var d = new Date()
    console.log("当前时间："+ d.getHours() + ":" + d.getSeconds());
    console.log('-------------------------------------------------------');
    //判断是否在正则表达式中
    var reg1 = /^\d{4}$/;
    console.log( reg1.test( '1234'),
    reg1.test( ' 1a34'),
    reg1.test( ' 12345'));
    console.log('-------------------------------------------------------');
    //函数表达式
    var reg2 = new RegExp( "^[sp]\\d{1,4}$", "i");
    console.log( reg2.test( 'p123' ),
    reg2.test( '1234'),
    reg2.test( 'S10')
    )
    //判断手机号是不是电信
    var phone = /^1(33|53|89|80)\d{8}$/;
    console.log( phone.test('13352045204'),
                 phone.test('18052045204'),
                 phone.test('10852045204')
                );
    //获取一个邮箱地址的前缀
    var arr4 = '2316801840@qq.com';
    console.log(parseInt(arr4));
    console.log('----------------------------------------------------------------------');
    //
    var num = Math.random() * 2 + 1;
    console.log(num.toFixed(0));
    console.log('----------------------------------------------------------------------');
    //7
    var x = 1;
    function A(y){
    var x = 2
    function B(z){
        console.log(x + y +z);
    }
    return B;
    }
    var C = A(2);
    C(3);

</script>
<div class="button"><a href="../index.html">返回首页</a></div>
</html>